0.1.1 • Published 11 months ago

anshulv1401-sign-in-with-esignet v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

sign-in-with-esignet

Renders a button that will navigate the user to esignet website for authentication. Follows Open Id connect protocol.

Installation

# using npm
npm i sign-in-with-esignet

# using yarn
yarn add sign-in-with-esignet

Props

proptypedefault valuenote
oidcConfigJson ObjectOpen Id connect configurations
buttonConfigJson ObjectConfiguration for sign in button

Prop oidcConfig

fieldtyperequireddefault valuenote
authorizeUristringYesThe authorize URI on the authorization server is where an OpenID Connect flow starts.
redirect_uristringYesThe redirect URI tells the issuer where to redirect the browser back to when the flow is done.
client_idstringYesEvery client (website or mobile app) is identified by a client ID. The client ID is a public value that does not have to be protected.
scopestringYesClients can request additional information or permissions via scopes. The openid scope is the only required scope.
response_typestringNocodeThe authorization server will respond with a code, which the client can exchange for tokens on a secure channel.
noncestringNoA nonce (or number used once) is a random value that is used to prevent replay attacks.
statestringRecommandedThe state is an optional value that is carried through the whole flow and returned to the client. Random value will be created if not provided.
acr_valuesstringNoRequested Authentication Context Class Reference values
claimsstringNoThe Client can obtain Claims about the End-User and the Authentication event. For more detail check Claims.
claims_localesstringNoEnd-User's preferred languages and scripts for Claims being returned.
ui_localesstringNoEnd-User's preferred languages and scripts for the user interface
displaystringNoASCII string value that specifies how the Authorization Server displays the authentication and consent user interface pages to the end user. Allowed values: page popup touch wap
max_agestringNoMaximum Authentication Age. This specifies the allowable elapsed time in seconds since the last time the end user was actively authenticated by the OP.
promptstringNoSpace delimited case-sensitive list of ASCII string values that specifies whether the Authorization Server prompts the End-User for re-authentication and consent. Allowed values: none login consent select_account

Prop buttonConfig

fieldtypevalid valuesdefault valuenote
typestring(“standard”, “icon”)"standard"The button type: icon, or standard button.
themestring(“outline”, “filled_blue”, “filled_black”, “custom”)“outline”The button theme.
shapestring(“sharp_edges”, “soft_edges”, “rounded_edges”)“sharp_edges”The button shape.
labelTextstring“Sign in with Esignet”The button text.
logoPathstringesignet logoPath to the id provider’s logo
widthnumber400pxThe button width, in pixels
backgroundstringBackground property of esignet button
textColorstringColor of label text
borderColorstringBorder color of esignet button
borderWidthstringBorder width of esignet button
fontstringfont of the label text
fontFamilystringfont family of the label text
customStylestringCustom styling option

Usage

# using import
import { SignInWithEsignet } from "sign-in-with-esignet";

Example

React JS

//configuration for Open id connect
useEffect(() => {
  SignInWithEsignet({
    oidcConfig: {
      authorizeUri: "https://esignet.dev.mosip.net/authorize",
      redirect_uri: "https://healthservices.dev.mosip.net/userprofile",
      client_id: "88Vjt34c5Twz1oJ",
      scope: "openid profile",
    },
    buttonConfig: {
      shape: "soft_edges",
      theme: "filled_orange",
    },
    signInElement: document.getElementById("sign-in-with-esignet"),
  });
}, []);


export default function MyComponent() {

return (
      <div id="sign-in-with-esignet"></div>
  );
}

/>;

HTML

<!DOCTYPE html>
<html>
  <body>
    <script type="module">
      import { SignInWithEsignet } from "<signin button JS url>";
      window.onload = function () {
        SignInWithEsignet({
          oidcConfig: {
            authorizeUri: "https://esignet.dev.mosip.net/authorize",
            redirect_uri: "https://healthservices.dev.mosip.net/userprofile",
            client_id: "88Vjt34c5Twz1oJ",
            scope: "openid profile",
          },
          buttonConfig: {
            shape: "soft_edges",
            theme: "filled_orange",
          },
          signInElement: document.getElementById("sign-in-with-esignet"),
        });
      };
    </script>
    <div id="sign-in-with-esignet"></div>
  </body>
</html>

/>;
0.1.0

11 months ago

0.1.1

11 months ago

0.0.1

12 months ago