[OpenAMUtils.js Documentation](openamUtils.md) ====== openamUtils.js is another wrapper to render configurable Login Buttons and Login Boxes using OpenAM. It requires openam.js and the css style contained in this repository, of course you can adjust the css to your needs but it should work nicely out of the box. This wrapper does not need JQuery, but of course you can combine it with any other JS UI framework. ### Table of Contents - [printLoginBox](#printloginboxelement-options) - [printLoginButton](#printloginbuttonelement-options) - [printLogoutButton](#printlogoutbuttonelement-options) - [printWelcomeAndLogout](#printwelcomeandlogoutelement-options--undefined) ### Methods #### printLoginBox(element, options) Renders a login button that can be clicked to create a login box. The login box may contain the interactive login credentials area plus a social login buttons area depending on the configuration of the "options" object and the configuration of the OpenAM being used. ##### Parameters:
Name Type Description
element HTMLElement | String the DOM element object where the button will be rendered
options Object | String The configuration object to use.
 The options object is a JSON object, here an example.  
 {
    openam: myOpenAMConfigObject,
    module: "DataStore",                                         // optional
    service: "ldapService",                                      // optional
    width: "600px",                                              // optional
    height: "300px",                                             // optional
    formId: "amLoginForm",                                       // optional
    gotoURL: "http://ap.example.com:8880/exampleNRO02.html",     // optional
    social: true,                                                // optional
    overrideSocialImplementations: mySocialImplementationsObject  // optional
 }   
 
Properties
Name Type Attributes Default Description
openam Object | String The OpenAM Configuration Object. This is a mandatory attribute. See openam.js documentation for more information
module String <optional>
OpenAM realm default The Authentication module to use in the left side of the login box.
service String <optional>
OpenAM realm default The Authentication service chain to use in the left side of the login box. Notice that service takes precedence over module.
width String <optional>
270px or as defined in openamUtils.css The Login Box width in px.
height String <optional>
620px or as defined in openamUtils.css The Login Box height in px.
formId String <optional>
amLoginForm The id of the form to be used to capture the credentials. It is recommended not to change it, unless there is a form Id colision in your HTML code.
gotoURL String <optional>
Current page The URL to go to after a successful authentication.
social String <optional>
true Boolean attribute to turn off the display of the social authentication buttons, if the OpenAM has been configured to show the social implementations in the login page.
overrideSocialImplementations Array.<Object> <optional>
This array of objects will override the socialImplementations array that is returned from the OpenAM serverinfo URL.
 Here an example of the overrideSocialImplementations object:
 [
     {
         "authnChain": "GoogleSocialAuthenticationService",
         "displayName": "Google",
         "iconPath": "images/google.png",
         "imgStyle": "display: block; max-width: 80% !important;",
         "valid": true,
         "buttonText": ''
     },
     {       
         "authnChain": "MicrosoftSocialAuthenticationService",
         "displayName": "Microsoft",
         "iconPath": "images/msn.png",
         "imgStyle": "display: block; max-width: 80% !important;",
         "valid": true,
         "buttonText": ''
     }
 ]
 
Properties
Name Type Attributes Default Description
authnChain String The name of the authentication chain that implements the specified social authentication
displayName String The name to be displayed for the specified social authentication
iconPath String The location of the icon to be displayed within the button for the specified social authentication
imgStyle String <optional>
"float: left;" The CSS style to be applied to the image referred in the iconPath attribute
valid Boolean <optional>
true Flag to specify if the socialImplementation object should be used or not
buttonText String <optional>
Sign in with <displayName> The text to be written within the button for the specified social authentication
Source: - [openamUtils.js](openamUtils.js.html), [line 602](openamUtils.js.html#line602) #### printLoginButton(element, options) Renders a login button that redirects to the module specified as a parameter ##### Parameters:
Name Type Description
element HTMLElement | String the DOM element object where the button will be rendered
options Object The configuration object to use
 The options object is a JSON object, here an example.  
 {
    openam: myOpenAMConfigObject,
    module: "DataStore",                                         // optional
    service: "ldapService",                                      // optional
    gotoURL: "http://ap.example.com:8880/exampleNRO02.html",     // optional
    gotoOnFail: "http://ap.example.com:8880/exampleNRO02.html",  // optional
    classic: false                                               // optional
    windowed: true,                                              // optional
 }   
Properties
Name Type Attributes Default Description
openam Object | String The OpenAM Configuration Object. This is a mandatory attribute. See openam.js documentation for more information
module String <optional>
OpenAM realm default The Authentication module to use in the left side of the login box.
service String <optional>
OpenAM realm default The Authentication service chain to use in the left side of the login box. Notice that service takes precedence over module.
gotoURL String <optional>
Current page The URL to go to after a successful authentication.
gotoOnFail String <optional>
Current page The URL to go to after an authentication event has failed.
classic String <optional>
false Boolean attribute to specify if we are using the classic UI or the XUI. Default is to use the XUI.
windowed String <optional>
true Boolean attribute to specify if the redirect will happen in a pop-up window or not.
Source: - [openamUtils.js](openamUtils.js.html), [line 742](openamUtils.js.html#line742) #### printLogoutButton(element, options) Renders a logout button that will invoke the logout service when clicked ##### Parameters:
Name Type Description
element HTMLElement | String the DOM element object where the button will be rendered
options Object The configuration object to use
 The options object is a JSON object, here an example.  
 {
    openam: myOpenAMConfigObject
 }   
 
Properties
Name Type Description
openam Object | String The OpenAM Configuration Object. This is a mandatory attribute. See openam.js documentation for more information
Source: - [openamUtils.js](openamUtils.js.html), [line 709](openamUtils.js.html#line709) #### printWelcomeAndLogout(element, options) → {undefined} Prints the Welcome message for the "identity" and the logout button in a div ##### Parameters:
Name Type Description
element String
options Object The object containing the configuration for this function
Example:
{
    openam: myOpenAM,
    message: "Welcome Mr. "
}
Properties
Name Type Description
openam Object The OpenAM Configuration Object. This is a mandatory attribute. See openam.js documentation for more information
message String The message to be shown as Welcome to the user/identity
Source: - [openamUtils.js](openamUtils.js.html), [line 25](openamUtils.js.html#line25) ##### Returns: Does not return anything. It overrides the element DOM Type undefined Documentation generated by [JSDoc 3.4.0](https://github.com/jsdoc3/jsdoc) and converted to markdown with [pandoc 1.17.0.3](https://github.com/jgm/pandoc) and some Patience.