summaryrefslogtreecommitdiff
path: root/idp/templates/views/login.vm
blob: b813dc00c607c736e4f730d9e2149c158bc454db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
##
## Velocity Template for DisplayUsernamePasswordPage view-state
##
## Velocity context will contain the following properties
## flowExecutionUrl - the form action location
## flowRequestContext - the Spring Web Flow RequestContext
## flowExecutionKey - the SWF execution key (this is built into the flowExecutionUrl)
## profileRequestContext - root of context tree
## authenticationContext - context with authentication request information
## authenticationErrorContext - context with login error state
## authenticationWarningContext - context with login warning state
## ldapResponseContext - context with LDAP state (if using native LDAP)
## rpUIContext - the context with SP UI information from the metadata
## extendedAuthenticationFlows - collection of "extended" AuthenticationFlowDescriptor objects
## passwordPrincipals - contents of the shibboleth.authn.Password.PrincipalOverride bean
## encoder - HTMLEncoder class
## request - HttpServletRequest
## response - HttpServletResponse
## environment - Spring Environment object for property resolution
## custom - arbitrary object injected by deployer
##
#set ($rpContext = $profileRequestContext.getSubcontext('net.shibboleth.idp.profile.context.RelyingPartyContext'))
#set ($username = $authenticationContext.getSubcontext('net.shibboleth.idp.authn.context.UsernamePasswordContext', true).getUsername())
#set ($passwordEnabled = false)
#if (!$passwordPrincipals or $passwordPrincipals.isEmpty() or $authenticationContext.isAcceptable($passwordPrincipals))
  #set ($passwordEnabled = true)
#end
##
#parse("layout.vm")

#@layout()
        <div class="column one">
          #parse("login-error.vm")
        
          <form action="$flowExecutionUrl" method="post">
        
          #set ($serviceName = $rpUIContext.serviceName)
          #if ($serviceName && !$rpContext.getRelyingPartyId().contains($serviceName))
            <legend>
              #springMessageText("idp.login.loginTo", "Login to") $encoder.encodeForHTML($serviceName)
            </legend>
          #end
                      
          #if ($passwordEnabled)
            <div class="form-element-wrapper">
              <label for="username">#springMessageText("idp.login.username", "Username")</label>
              <input class="form-element form-field" id="username" name="j_username" type="text"
              	value="#if($username)$encoder.encodeForHTML($username)#end">
            </div>
        
            <div class="form-element-wrapper">
              <label for="password">#springMessageText("idp.login.password", "Password")</label>
              <input class="form-element form-field" id="password" name="j_password" type="password" value="">
            </div>
        
            <div class="form-element-wrapper">
              <input type="checkbox" name="donotcache" value="1" id="donotcache">
              <label for="donotcache">#springMessageText("idp.login.donotcache", "Don't Remember Login")</label>
             </div>
          #end
        
          #if ($passwordEnabled)
            <div class="form-element-wrapper">
              <button class="form-element form-button" type="submit" name="_eventId_proceed"
                  onClick="this.childNodes[0].nodeValue='#springMessageText("idp.login.pleasewait", "Logging in, please wait...")'"
                  >#springMessageText("idp.login.login", "Login")</button>
            </div>
          #end
        
          #foreach ($extFlow in $extendedAuthenticationFlows)
            #if ($authenticationContext.isAcceptable($extFlow) and $extFlow.apply(profileRequestContext))
              <div class="form-element-wrapper">
                <button class="form-element form-button" type="submit" name="_eventId_$extFlow.getId()">
                  #springMessageText("idp.login.$extFlow.getId().replace('authn/','')", $extFlow.getId().replace('authn/',''))
                </button>
              </div>
            #end
          #end
          </form>
        
          
        </div>
        <div class="column two">
          #*        
            //
            //    SP Description & Logo (optional)
            //    These idpui lines will display added information (if available
            //    in the metadata) about the Service Provider (SP) that requested
            //    authentication. These idpui lines are "active" in this example
            //    (not commented out) - this extra SP info will be displayed.
            //    Remove or comment out these lines to stop the display of the
            //    added SP information.
            //
          *#
          <h2>$encoder.encodeForHTML($serviceName)</h2>
          <p>
            #springMessageText("idp.login.sploginTo", "You have asked to login to") $encoder.encodeForHTML($serviceName)
          </p>
          #set ($logo = $rpUIContext.getLogo())
          #if ($logo)
            <img src= "$encoder.encodeForHTMLAttribute($logo)"
                alt="$encoder.encodeForHTMLAttribute($serviceName)">
          #end
          #set ($desc = $rpUIContext.getServiceDescription())
          #if ($desc)
            $encoder.encodeForHTML($desc)
          #end
        </div>
#end